<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
</head>
<body>
  <div id="app">
    <ul>
      <li v-for="i in mag">
        <span>{{i.name}}</span>
        <button @click="fnn(i.id)">删除</button>
      </li>
    </ul>
    <button @click="fn">生成</button>
  </div>
  <script>
  const app = new Vue({
    el:'#app',
    data:{
     mag:[
        {
        id:1,
        name:1
      },{
        id:2,
        name:2
     },{id:3,
        name:3
     }]

    },
    methods: {
        fn(){
           this.mag.push({
            id:new Date(),
            name:Math.floor(Math.random()*100)
           })

        },
        fnn(id){
           console.log(id);
          this.mag = this.mag.filter(i=> i.id !== id)
        }
    }
  })
  </script>
</body>
</html>